*******************************************************************************
*** Description: 	This document provides code for reproducing the 		***
***					figures in Study 3 of the paper, "Elections Increase 	***
***					Satisfaction with Democracy," which is authored by 		***
***					Shane P. Singh and appears in Comparative Political		***
***					Studies. It also provides code for reproducing			***
***					statistics associated with claims made in the text.		***
*******************************************************************************


**************
**************
*Set the Version                                                                                                                                 
**************
**************
version 17



**************
**************
*Install Required Packages                                                                                                                 
**************
**************
ssc install coefplot
ssc install yalescheme



**************
**************
*Open the Study 3 Dataset
**************
**************
use "Study 3.dta", clear



**************
**************
*Evidence for Claim Made in the Text: 
*I cautiously assume a small effect size (Cohen's d = 0.2). To detect this at the ten percent
*significance level with 80 percent power, 310 observations per experimental group are needed.
**************
**************	
power twomeans 0 .2, alpha(.1) power(.8)



**************
**************
*Evidence for Claim Made in the Text: 
*I was able to collect 334 usable observations in the treatment group and
*316 in the control condition. 
**************
**************	
tab election_2023 if sat_dem_post ~=. & age ~=. & income ~=. & education_level ~=. & gender_cat ~=. & turnout_propensity_pre ~=. 



**************
**************
*Evidence for Claim Made in the Text: 
*...92.8 percent of treated respondents correctly answered an inquiry about its content.
**************	
**************
tab FMC_TR_passed election_2023, column




**************
**************
*Evidence for Claim Made in the Text: 
*In the control group, 93.3 percent of respondents correctly answered an inquiry 
*about the content of the grass vignette.
**************	
**************
tab FMC_TR_passed election_2023, column




**************
**************
*Figure 6
**************
**************
reg sat_dem_post i.election_2023 age income education_level i.gender_cat if  turnout_propensity_pre ~=.
margins, dydx(election_2023) post  level(90)
est store election_2023


reg sat_dem_post i.election_2023##i.turnout_propensity_pre age income education_level i.gender_cat if  turnout_propensity_pre ~=.
margins, dydx(election_2023) at(turnout_propensity_pre = (1 4)) post 
est store election_2023_turnout


graph set window fontface "LMRoman10-Regular" 

coefplot ///
		(election_2023, offset(0) recast(scatter) mcolor(black) msize(medium) ciopts(lpattern(solid) lcolor(black))) ///
		(election_2023_turnout, offset(0) recast(scatter) mcolor(black) msize(medium) ciopts(lpattern(solid) lcolor(black))) ///
	,  scheme(yale) horizontal 	///
	coeflabels( 1.election_2023  	= 									`" "Main" "Model"  "'  ///
				1._at  	= 												`" "Not a Prior" "Voter"  "'  ///
				2._at  	= 												`" "Habitual" "Voter"  "'  ///
				) ///
	legend(off) ///
	graphregion(margin(small)) /// 
	xlabel(-2(.5)2, labsize(vsmall)) xscale(range(-2.1 2.1)) xtitle("Estimated Ef`=uchar(14)'fect of Election Vignette on" "Satisfaction with Democracy", size(small) margin(top)) ///
	ylabel(, labsize(vsmall))  ///
	xline(0,   lcolor(gs10) lwidth(thin) lpattern(solid)) ///
	level(90) format(%9.1f) ysize(2) xsize(7.5) scale(3.25) ///
	graphregion(color(white) lcolor(black) lwidth(thick) margin(medsmall)) 



**************
**************
*Evidence for Claim Made in the Text: 
*Mean SWD among those in the election treatment is 0.26 units greater 
*than among those in the control condition. This difference slightly misses 
*the pre-registered ten percent level of statistical significance (two-sided p-value = 0.130).
**************	
**************
reg sat_dem_post i.election_2023 age income education_level i.gender_cat if  turnout_propensity_pre ~=.




**************
**************
*Evidence for Claim Made in the Text: 
*...90.2 percent of respondents reported usually or always voting in recent elections.
**************	
**************
tab turnout_propensity_pre if sat_dem_post ~=. & age ~=. & income ~=. & education_level ~=. & gender_cat ~=. & election_2023 ~=. 



 
**************
**************
*Evidence for Claim Made in the Text: 
*The treatment effect is not statistically different from zero for nonvoters (two-sided p-value = 0.864)
*or routine voters (two-sided p-value = 0.206), and the two conditional treatment effects are not
*statistically different from one another (two-sided p-value = 0.678). 
**************	
**************
reg sat_dem_post i.election_2023##i.turnout_propensity_pre age income education_level i.gender_cat
margins, dydx(election_2023) at(turnout_propensity_pre = (1 4)) post 
est store election_2023_turnout
test _b[1.election_2023:1bn._at] =  _b[1.election_2023:2._at]


 
 
**************
**************
*Figure 7
**************
**************
reg sat_dem_post i.election_2023##i.win_SD_other_none age income education_level i.gender_cat if  turnout_propensity_pre ~=. 
margins, dydx(election_2023) at(win_SD_other_none = (1 2 3 4)) post  level(90)
est store win_SD_other_none

graph set window fontface "LMRoman10-Regular" 

coefplot ///
		(win_SD_other_none, offset(0) recast(scatter) mcolor(black) msize(medium) ciopts(lpattern(solid) lcolor(black))) ///
	,  scheme(yale) horizontal 	///
	coeflabels( 1._at  	= 												`" "Attachment to" "a Winning Party"  "'  ///
				2._at  	= 												`" "Attachment to" "Social Democrats"  "'  ///
				3._at  	= 												`" "Attachment to" "Other Party"  "'  ///
				4._at  	= 												`" "No Party" "Attachment"  "'  ///
				) ///
	legend(off) ///
	graphregion(margin(small)) /// 
	xlabel(-2(.5)2, labsize(vsmall)) xscale(range(-2.1 2.1)) xtitle("Estimated Ef`=uchar(14)'fect of Election Vignette on" "Satisfaction with Democracy", size(small) margin(top)) ///
	ylabel(, labsize(vsmall))  ///
	xline(0,   lcolor(gs10) lwidth(thin) lpattern(solid)) ///
	level(90) format(%9.1f) ysize(2.7) xsize(7.5) scale(2.5) ///
	graphregion(color(white) lcolor(black) lwidth(thick) margin(medsmall))







*       ,::////;::-.
*      /:'///// ``::>/|/
*    .',  ||||    `/( e\
*-==~-'`-Xm````-mm-' `-_\  * Thanks for replicating!
